<?php
namespace TpAmis\Plugin\AmazonRichTextControl;

use think\facade\Env;
use TpAmis\Renderers\Custom;
use TpAmis\Renderers\RichTextControl;

class AmazonRichTextControl extends RichTextControl
{
    protected array $options = [];

    protected array $extend_js_list = [
        '/static/tpamis/plugin/AmazonRichTextControl/jquery-3.6.0.min.js',
        '/static/tpamis/plugin/AmazonRichTextControl/AmazonRichTextControl.js',
    ];
    protected array $extend_css_list = [];
    protected array $extend_js_script = [

        //js代码：注册自定义组件
        'regJsonEditor(amisLib, React);',
    ];
    public function getExtendJsLst()
    {
        return $this->extend_js_list;
    }
    public function __construct()
    {
        parent::__construct();
        $this->set('type', 'richjson');
        Env::set('extend_js_list', $this->extend_js_list);
        Env::set('extend_js_script', $this->extend_js_script);
    }

    /**
     * 字段名，表单提交时的 key，支持多层级，用.连接，如： a.b.c
     */
    public function name($value = '')
    {
        $this->set('name', $value.'_default');
        return $this->set('real', $value);
    }

}
